#pragma once
#ifndef __SCREEN_H__
#define __SCREEN_H__

class WAB_Viewport
{
private:
    int32 view_width;
    int32 view_height;
    int32 view_xPos;
    int32 view_yPos;

    bool initialized;
public:
    WAB_Viewport();
    WAB_Viewport(int32 width, int32 height, int32 xPos, int32 yPos);

    void loadViewport();

    void setPosition(int32 xPos, int32 yPos);
    void setDimensions(int32 width, int32 height);
    void getDimensions(int32* width, int32* height, int32* xPos = NULL, int32* yPos = NULL);
};

#define NUM_MAX_VIEWPORTS 3

class WAB_Screen
{
private:
    WAB_Screen();
    WAB_Screen(const WAB_Screen&);

    int32 screen_width;
    int32 screen_height;
    int32 window_x;
    int32 window_y;

    WAB_Viewport viewports[NUM_MAX_VIEWPORTS];
    int32 numViewports;

    bool initialized;

    char screenTitle[kStrBufferLen_Medium];
public:
    WAB_Screen(int32 width, int32 height, int32 winX, int32 winY);

    void init();
    void swapBuffers();
    void runMainLoop();

    WAB_Viewport* addViewport(int32 width, int32 height, int32 xPos, int32 yPos);
    void setRenderFunction(glDisplayFunc displayFunc);

    void setTitle(const char* title);
    void getDimensions(int32* width, int32* height, int32* winX, int32* winY);
};

#endif
